<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>

    </style>
  </head>
  <!-- <body style="height: 2000px" onscroll="fun3('滚动事件')"> -->
  <body>
    <!-- <a href="http://www.baidu.com" onclick="fun2()">百度</a>
    <form action="www.baidu.com" onsubmit="fun()">
      用户名：<input type="text" id="username" /> 密 码：<input
        type="password"
        id="pwd"
      />
      <input type="submit" value="登录" />
    </form>
    <div
      onmouseup="fun3('up')"
      onmousedown="fun3('down')"
      onfocus="fun3('focus')"
      oncopy="fun3('copy')"
    >
      6666666666
    </div>
    <button onmouseup="fun3('up')" onmousedown="fun3('down')">777776644</button>
    <input
      type="text"
      onkeydown="fun3('keydown')"
      onkeyup="fun3('keydup')"
      onfocus="fun3('focus')"
      onblur="fun3('onblur')"
      onpaste="fun3('粘贴')"
      onselect="fun3('选中事件')"
    />
    <textarea name="" id="" cols="30" rows="10" onselect="fun3('选中事件')">
        sadasdas
    </textarea> -->
    <!-- <div id="con">
      <h1>123</h1><div>
        666
        <span>span</span>
      </div>
    </div> -->
    <button onclick="fun4()">点击</button>
  </body>
  <script>
    function fun4() {

      // console.log(document.getElementById('con').childNodes)
      // document.write("<button>123</button>")
      // console.log("<button id='abc'>123</button>");
      var btnObj = document.createElement('button')
      btnObj.innerHTML = 999
      btnObj.id = "abc"
      // btnObj.className = 
      btnObj.style.width = '300px'
      document.querySelector
      document.getElementsByTagName('body')[0].appendChild(btnObj)
      console.log(btnObj);  
    }
    // function fun3(params) {
    //   //   console.log(event)
    //   //   if (event.keyCode == 13) {
    //   //获取你的输入信息 然后进行提交
    //   //   }
    //   console.log(params)
    // }
    // function fun() {
    //   //   event.preventDefault() // 阻止浏览器默认行为
    //   var username = document.getElementById('username').value,
    //     pwd = document.getElementById('pwd').value
    //   if (username.length < 3 || pwd < 3) {
    //     event.preventDefault()
    //     return false
    //   } else {
    //     //一些代码
    //     return true
    //   }
    // }
  </script>
</html>
